/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.ac.cput.ADP.Conform.PostOffice.Impl;


import za.ac.cput.ADP.Conform.Mail.Mail;
import za.ac.cput.ADP.Conform.PostOffice.PostOffice;
import za.ac.cput.ADP.Conform.PostOffice.Services.PostOfficeServices;
import za.ac.cput.ADP.Conform.PostOffice.Services.RegionalCreation;
import za.ac.cput.ADP.conform.Client.Client;

/**
 *
 * @author Oceanwave
 */
public class PostOfficeImp implements PostOffice
{
    
    PostOfficeServices services;
    double totalMoney;
    int amtMailBoxes;
    String uniqueID;

    public PostOfficeImp() 
    {
        totalMoney = 0;
        amtMailBoxes = 0;
        services = new RegionalCreation();
    }

    public PostOfficeImp(String uniqueID) 
    {
        totalMoney = 0;
        amtMailBoxes = 0;
        services = new RegionalCreation();
        this.uniqueID = uniqueID;
    }

    @Override
    public double getTotalMoney() 
    {
        return totalMoney;
    }
    

    @Override
    public void stampMail(Mail recievedMail)
    {
        totalMoney += recievedMail.determineStampValue();
        recievedMail.setCertified();
    }
    

    @Override
    public void createAccount(Client inputClient)
    {
        amtMailBoxes++;
        services.createAccount(inputClient, amtMailBoxes, uniqueID);
    }
    
    @Override
    public void sendMail(Mail recievedMail, Client inputClient)
    {
        recievedMail.setSender(inputClient.getName(), inputClient.getSurname());
        System.out.println("Mail sent successfully");
    }
    
    @Override
    public void printReport()
    {
        System.out.println("ID: " + uniqueID + "\n" + "amtMailBoxes: " + amtMailBoxes + "\n" + "TotalMoney: " + totalMoney);
    }
    
}
